Skip to main content

5.5 Dataset

Teleoperating your KikoBot C1 is done, now it's time to take it a step further and record a dataset! This is an essential part of developing and training models for your robot. Let’s dive into how you can create and upload your first dataset, ready to be shared or used for neural network training.

Step 1: Log in to Hugging Face Hub

To upload your dataset to the Hugging Face Hub, you’ll need to have write access. If you haven’t logged in before, here’s how to do it:

  1. Generate a Hugging Face Token from your Hugging Face settings.
  2. Login using the following command:
    huggingface-cli login --token ${HUGGINGFACE_TOKEN} --add-to-git-credential

This step ensures that you have the necessary permissions to upload your dataset to Hugging Face's cloud storage.

Step 2: Store Your Hugging Face Repository Name

Next, let’s make sure that you store your Hugging Face username to use later when uploading the dataset. Run the following commands in your terminal:

HF_USER=$(huggingface-cli whoami | head -n 1)

echo $HF_USER

This will store your Hugging Face username, which you’ll need to include when running the script to upload your dataset.

Step 3: Record Your First Dataset

Now that you're set up and ready, it’s time to record the first dataset. Using a simple script, you can start recording data based on the robot's movements.

Here’s the command to begin recording 2 episodes of robot movement:

python lerobot/scripts/control_robot.py record 

--robot-path lerobot/configs/robot/kikobot.yaml

--fps 30

--repo-id ${HF_USER}/kikobot_test

--tags kikobot tutorial dataset

--warmup-time-s 5

--episode-time-s 40

--reset-time-s 10

--num-episodes 2

--push-to-hub 1

Explanation of the Parameters:

  • --robot-path lerobot/configs/robot/kikobot.yaml: Specifies the configuration file for your KikoBot C1, ensuring the correct robot setup.
  • --fps 30: Sets the frames per second for the dataset capture.
  • --repo-id ${HF_USER}/kikobot_test: Names the dataset repository on Hugging Face for easy access.
  • --tags kikobot tutorial dataset: Adds tags to your dataset, making it easier to search and categorize.
  • --warmup-time-s 5: A 5-second warmup period before the actual recording starts.
  • --episode-time-s 40: Defines each episode’s duration (40 seconds).
  • --reset-time-s 10: Gives the robot 10 seconds to reset between episodes.
  • --num-episodes 2: Records two episodes of the robot's actions.
  • --push-to-hub 1: Uploads the recorded dataset directly to the Hugging Face Hub.

Once you run the above script, the robot will begin recording its movements, and the data will be automatically uploaded to your Hugging Face account.

Step 4: Visualize the Dataset

After your dataset is successfully uploaded to the Hugging Face Hub, you can view it online. To do this, simply copy your repository ID and use it to access the dataset:

echo ${HF_USER}/kikobot_test

Now, paste the output into the Hugging Face website to visualize your dataset.

Alternatively, if you didn't upload the dataset to the Hub, you can visualize it locally by running the following:

python lerobot/scripts/visualize_dataset_html.py 

--repo-id ${HF_USER}/kikobot_test

This will generate a local HTML file where you can see the recorded episodes, check the robot’s movements, and ensure everything is as expected.

Step 5: Replay an Episode

Once your dataset is recorded and ready, you can replay one of the episodes directly on your KikoBot C1. This is helpful for testing and evaluating the robot's performance based on the recorded data.

Run the following script to replay the first episode:

python lerobot/scripts/control_robot.py replay 

--robot-path lerobot/configs/robot/kikobot.yaml

--fps 30

--repo-id ${HF_USER}/kikobot_test

--episode 0

This will cause the robot to replay episode 0 from the recorded dataset, allowing you to see how the robot executes the movements that were recorded.

By following these steps, you can easily record, upload, and visualize datasets with your KikoBot C1. Whether you're testing the robot's movements or preparing for future machine learning tasks, these tools will help you build a strong foundation for robotic data collection and training. Happy recording!